<?php 
//Load variables
include_once '../classes/supervisor.php';

$supervisor_ID = $_GET['supervisor_id'];
if ($_GET['update']) $supervisor_ID = $_GET['sup_id'];

$details = Supervisor::getSupervisorDetails($supervisor_ID);

$cs = Supervisor::getAllocation($supervisor_ID);

if ($details['sup_available'] == 1) $is_checked = "checked=\"checked\"";

$sup_supervise_subjects = "";

foreach ($cs as $sup) {
	$sup_supervise_subjects = $sup_supervise_subjects . ' | ' . $sup;
}
$sup_supervise_subjects = $sup_supervise_subjects . ' | ';


?>

<?php include 'header.page.php'; ?>

	<!--Side body starts here, it contains the stuff that change from page to page.-->
    <div class="site_body">
 		<!-- This is the begining of the left column, it will contain controls -->
        <div class="left_col">
        
        <form action="index.php" method="get">
        
          <table width="450" border="0" style="margin:25px auto 0px auto;">
            <tr>
              <td width="29%" height="44" align="right">Supervisor ID :</td>
              <td width="50%" align="center" valign="middle"><label for="supervisor_id"></label>
              <input type="text" name="supervisor_id" id="supervisor_id" style="width:95%;" /></td>
              <td width="21%" align="left"><input type="submit" name="select" id="select" value="Submit" /></td>
            </tr>
            <tr>
            	<td colspan="3">
	                <hr style="padding:0px; margin:0px; border-color:#CCC;" />
                </td>
            </tr>
          </table>
        <table width="95%" border="0" style="margin:20px auto 0px auto;">
          <tr align="left">
            <td colspan="2"><p style="text-decoration:underline; margin:0px; padding:0px;"><strong>Basic Details</strong></p></td>
          </tr>
          <tr>
            <td width="24%" align="right">Sup ID :</td>
            <td width="76%"><label for="sup_id"></label>
            <input name="sup_id" type="text" id="sup_id" style="width:200px;" value="<?php echo $details['sup_id']; ?>" readonly="readonly" /></td>
          </tr>
          <tr>
            <td align="right">Sup name :</td>
            <td><label for="sup_name"></label>
            <input name="sup_name" type="text" id="sup_name" style="width:95%;" value="<?php echo $details['sup_name']; ?>" /></td>
          </tr>
          <tr>
            <td align="right">Department :</td>
            <td><input name="sup_department" type="text" id="sup_department" style="width:70px;" value="<?php echo $details['sup_department']; ?>" /></td>
          </tr>
          <tr>
            <td align="right">Available :</td>
            <td><input name="sup_available" type="checkbox" id="sup_available" value="1" <?php echo $is_checked; ?> />
            Supervisor Available
            <label for="sup_available"></label></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr align="left">
            <td colspan="2"><strong><span style="text-decoration:underline; margin:0px; padding:0px;">Supervision</span></strong></td>
          </tr>
          <tr>
            <td colspan="2"><?php echo $sup_supervise_subjects; ?>
            <hr style="padding:0px; margin:0px; border-color:#CCC;" /></td>
          </tr>
          <tr>
            <td colspan="2" align="center"><input name="action" type="hidden" id="action" value="supervisor_page" />
              <input type="submit" name="update" id="update" value="Update" />
            <input type="submit" name="delete" id="delete" value="Delete" /></td>
          </tr>
        </table>
		</form>
      	</div>
        <!-- Left column ends here -->
        
        <!-- This is the begining of the right column, it will contain the summary of the -->
        <div class="right_col">
        	<?php include 'rightcol.page.php';?>
        </div>
        <!-- Right column ends here-->
        
	</div>
    <!--Side body ends here-->
    
    <div class="footer">
    
    </div>
    
    <div style="clear:both;"></div>
</div>
<!-- End of container -->
</body>
</html>